﻿using System;
using Engine.Graphics;
using Game;

namespace Mekiasm
{
    public class IronFurnaceWidget : BaseEnergyWidget
    {
        ComponentIronFurnace Component;
        public IronFurnaceWidget(ComponentIronFurnace stoneFurnace, ComponentMiner componentMiner) : base(componentMiner)
        {
            Component = stoneFurnace;
            mekProgress.SetProgressType(MekProgressWidget.ProgessType.vertical_rate);
            MekCraftingRecipe.FindCraftDevice(typeof(IronFurnace)).GenerateRecipeWidget(CanvasMain, stoneFurnace,componentMiner, ref Tick);
            Overlay.Texture = ContentManager.Get<Texture2D>("Mekiasm/Gui/Tabs/heat_info");
            setTitle("铁炉");
        }

        public override void Update()
        {
            Tick?.Invoke();
            string n = ILibrary.FormatFloat(Component.Temprature, "K");
            string n2 = ILibrary.FormatFloat(Component.MaxTemprature * Component.MaxFactor, "K");
            string n3 = ILibrary.FormatFloat(Component.HeatLevel, "K");
            SetLeftBottomMoreInfo($"当前温度:{n}\n最高温度:{n2}\n热能等级:{n3}\n熔炼效率:{n3}");
            SetPowerProgress(Component.Temprature / (Component.MaxTemprature * Component.MaxFactor));
        }
    }
}
